package thread;
import java.io.*;
import java.net.Socket;
public class TCPEchoClient {
    public static void main(String args[]){
        try{
            Socket s = new Socket("localhost", 2014);
            InputStream is =s.getInputStream();
            OutputStream os=s.getOutputStream();
            for(int i='0'; i<='9'; i++){
                System.out.print("gui di: "+i);
                os.write(i);
                int ch=is.read();
                System.out.print((char)ch);
            }
        }
        catch(IOException ie){
            System.out.println("Loi: khong tao duoc socket");
        }
    }
}
